package org.nf.ssm.service.impl;

import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.nf.ssm.dao.BorrowDao;
import org.nf.ssm.domain.Borrow;
import org.nf.ssm.service.BorrowService;
import org.springframework.stereotype.Service;

/**
 * @author zhu
 * @date 2024-10-17
 */
@Service("borrowService")
@RequiredArgsConstructor
public class BorrowServiceImpl implements BorrowService {

    private final BorrowDao borrowDao;

    @Override
    public void addBorrow(Borrow borrow) {
        borrowDao.addBorrow(borrow);
    }

    @Override
    public void deleteBorrow(Integer index) {
        borrowDao.deleteBorrow(index);
    }

    @Override
    public PageInfo<Borrow> getAllBorrow(Integer pageNum, Integer pageSize, String bookName, String borrowId, String borrowType, Integer typeId) {
        return new PageInfo<>(borrowDao.getAllBorrow(pageNum, pageSize, bookName, borrowId, borrowType, typeId));
    }

    @Override
    public void updateBorrow(Borrow borrow) {
        borrowDao.updateBorrow(borrow);
    }
}
